﻿#region License statement
// NJamb, a specification and delta-specification DSL
// Copyright (c) 2010-2011, Mark Knell
// Published under the MIT License; all other rights reserved
#endregion

#region using...
using System;
using System.Collections.Generic;
using NJamb.Parser.SpecificationBuilders.Delta.Enumerable;
using NJamb.Parser.Subjects;
using Stile.Patterns.SelfDescribingPredicates;
#endregion

namespace NJamb.Specifications.Simple.Enumerable
{
    public class EnumerableSpecification<TSubject, TItem> :
        Specification<TSubject, ICollaboratingSubject<TSubject>, IEnumerableDeltaSpecificationBuilder<TSubject, TItem>>,
        IEnumerableSpecification<TSubject, TItem>
        where TSubject : class, IEnumerable<TItem>
    {
        public EnumerableSpecification(ICollaboratingSubject<TSubject> collaboratingSubject,
            ISelfDescribingPredicate<TSubject> selfDescribingPredicate,
            Lazy<string> lazyReason = null,
            Func<Exception, TSubject, IEvaluation<TSubject>> exceptionFilter = null)
            : base(collaboratingSubject, selfDescribingPredicate, lazyReason, exceptionFilter) {}

        protected override IEnumerableDeltaSpecificationBuilder<TSubject, TItem> Factory()
        {
            return new EnumerableDeltaSpecificationBuilder<TSubject, TItem>(this);
        }
    }
}
